<?php
abstract class ResponseData extends ArrayObject
{
	public $header = null;
	
	/**
	 * Data response
	 *
	 * @param string $name object name
	 */
	public function __construct($name)
	{
		$filename = PATH2LOGIC.$name.'.php';
		
		if (file_exists($filename)) {
			require_once($filename); // must be required once
			
			$object = new $name();
			
			if (count($_POST)) {
				if (method_exists($object, 'post')) {
					$object->post();
				}
			}
			
			if (method_exists($object, 'get')) {
				$object->get();
			}
			
			$this->exchangeArray($object->getArrayCopy());
		}
	}
	
	abstract public function __toString();
}